//
//
//
//
//
// FileAdapter.C

#include "FileAdapter.h"


static FileAdapter __FILE_ADAPTER_INST;

FileAdapter::FileAdapter(){};
FileAdapter::~FileAdapter(){};

bool FileAdapter::Open(const std::string& path)
{
	_file.Open(path, File::_O_CREAT | File::_O_TRUNC | File::_O_WRONLY,
			File::_S_IRUSR | File::_S_IWUSR | File::_S_IRGRP | File::_S_IWGRP | File::_S_IROTH);
	return _file.IsOpen();
}

void FileAdapter::Report(void)
{
}

bool FileAdapter::Log(const std::string& info)
{
	_file << info;
	return true;
}

LogManager::ADAPTER_TYPE FileAdapter::AdapterType()
{
	return LogManager::FILE_ADAPTER_TYPE;
}

void FileAdapter::Flush()
{
	if(_file.IsOpen())
		_file.Flush();
}

bool FileAdapter::Close()
{
	_file.Close();
	return true;
}
